home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-02-22 | 3.7 KB | 124 lines |
- 10 'CAPTANCE - Capacitance Calculator - 08 JAN 93 rev. 22 FEB 97
- 20 IF EX$=""THEN EX$="EXIT"
- 30 CLS:KEY OFF
- 40 VIEW PRINT
- 50 COLOR 7,0,1
- 60 DIM DK$(20,3)
- 70 UL$=STRING$(80,205)
- 80 U$="###,###.###"
- 90 U1$="#######"
- 100 '.....read data
- 110 FOR Z=1 TO 20
- 120 FOR Y=1 TO 3:READ DK$(Z,Y):NEXT Y
- 130 NEXT Z
- 140 '
- 150 '.....start
- 160 CLS
- 170 PRINT " DIELECTRIC MATERIAL ";TAB(29);" CONSTANT (K) ";
- 180 PRINT TAB(43);" PUNCTURE VOLTAGE per .001";CHR$(34);" thickness ";
- 190 '
- 200 '.....print reference table
- 210 FOR Z=1 TO 20
- 220 DOT$=STRING$(26-LEN(DK$(Z,1)),".")+" "
- 230 PRINT " <";CHR$(96+Z);"> ";
- 240 PRINT DK$(Z,1);DOT$;DK$(Z,2);TAB(45);DK$(Z,3)
- 250 NEXT Z
- 260 PRINT UL$;
- 270 COLOR 0,7:LOCATE CSRLIN,22
- 280 PRINT " Press 1 to continue or 0 to EXIT....."
- 290 COLOR 7,0
- 300 Z$=INKEY$:IF Z$=""THEN 300
- 310 IF Z$="0"THEN CLS:RUN EX$
- 320 IF Z$="1"THEN 340
- 330 GOTO 300
- 340 LOCATE CSRLIN-1:PRINT STRING$(80,32);:LOCATE CSRLIN-1
- 350 '
- 360 '.....inputs
- 370 PRINT " Press <ENTER> if the data requested below is what you are ";
- 380 PRINT "seeking, or"
- 390 VIEW PRINT 24 TO 24
- 400 COLOR 0,7
- 410 IF C=0 THEN INPUT" ENTER Capacitance in pF...............................";C
- 420 GOSUB 630
- 430 '
- 440 IF K THEN 560
- 450 INPUT " ENTER Letter in < > in above table to select dielectric......";Z$
- 460 IF Z$=""THEN 540
- 470 IF Z$="t"THEN 510
- 480 Z=ASC(Z$)-96:MATL$=DK$(Z,1):K=VAL(DK$(Z,2)):PV=VAL(DK$(Z,3))
- 490 GOTO 540
- 500 '
- 510 INPUT" ENTER Name of dielectric material between plates......";MATL$
- 520 INPUT" ENTER K Constant of dielectric material...............";K
- 530 INPUT" ENTER Puncture voltage (if known).....................";PV
- 540 GOSUB 630
- 550 '
- 560 IF A=0 THEN INPUT" ENTER Sq.inches of area common to adjacent plates.....";A
- 570 GOSUB 630
- 580 IF N=0 THEN INPUT" ENTER Number of plates................................";N
- 590 GOSUB 630
- 600 IF D=0 THEN INPUT" ENTER Separation of adjacent plates in inches.........";D
- 610 GOSUB 630
- 620 GOTO 390
- 630 '.....compute unknown factor
- 640 COLOR 7,0:CLS
- 650 J=0.2248
- 660 IF K*A*N*D THEN C=J*K*A*(N-1)/D:GOTO 710
- 670 IF C*A*N*D THEN K=C/J/A/(N-1)*D:GOTO 710
- 680 IF C*K*N*D THEN A=C/J/K/(N-1)*D:GOTO 710
- 690 IF C*K*A*D THEN X=C/J/K/A*D:N=X+1:GOTO 710
- 700 IF C*K*A*N THEN D=J*K*A*(N-1)/C:GOTO 710
- 710 IF C*K*A*N*D THEN 750
- 720 COLOR 0,7
- 730 RETURN
- 740 '
- 750 '.....print results
- 760 VIEW PRINT
- 770 CLS:COLOR 7,0
- 780 INPUT " ENTER thickness of plates (inches).............";T
- 790 CLS:COLOR 15,2
- 800 PRINT " CAPACITOR DESIGN PARAMETERS ";TAB(57);"by George Murphy VE3ERP ";
- 810 COLOR 1,0:PRINT STRING$(80,223);
- 820 COLOR 7,0
- 830 PRINT" Dielectric .........................";" ";MATL$
- 840 PRINT" Dielectric constant.................";USING U$;K
- 850 IF PV=0 THEN 880
- 860 PRINT" Puncture voltage....................";USING U$;D*1000*PV;
- 870 PRINT " volts"
- 880 PRINT" Area common to adjacent plates......";USING U$;A;:PRINT " sq.in."
- 890 IF INT(N)=N THEN N$=U1$ ELSE N$=U$
- 900 PRINT" Number of plates....................";USING N$;N
- 910 PRINT" Distance between plates.............";USING U$;D;:PRINT " in."
- 920 PRINT" Thickness of plates.................";USING U$;T;:PRINT " in."
- 930 S=CINT(N)*T+(D*(N-1))
- 940 PRINT" Thickness overall...................";USING U$;S;:PRINT " in."
- 950 PRINT" Capacitance.........................";USING U$;C;:PRINT " pF"
- 960 PRINT UL$;
- 970 LN=CSRLIN-1:GOSUB 1110
- 980 MATL$="":C=0:K=0:PV=0:A=0:N=0:D=0:T=0:S=0
- 990 GOTO 150
- 1000 '
- 1010 DATA Air,1.0,21,Alsimag 196,5.7,240,Bakelite,4.4-5.4,300
- 1020 DATA Bakelite (mica filled),4.7,325-375, Cellulose acetate,3.3-3.9,250-600
- 1030 DATA Fibre,5-7.5,150-180,Formica,4.6-4.9,450,Glass (window),7.6-8,200-250
- 1040 DATA Glass (Pyrex),4.8,335,Mica (ruby),5.4,2800-5600,Mycalex,7.4,250
- 1050 DATA Paper (Royal grey),3,200,Plexiglas,2.8,990,Polyethylene,2.3,1200
- 1060 DATA Polystyrene,2.6,500-700,Porcelain,5.1-5.9,40-100
- 1070 DATA Quartz (fused),3.8,1000,Steatite (low loss),5.8,150-315
- 1080 DATA Teflon,2.1,1000-2000,OTHER," "," "
- 1090 END
- 1100 '
- 1110 'HARDCOPY
- 1120 GOSUB 1230:LOCATE 25,2:COLOR 14,6
- 1130 PRINT " Press 1 to print screen, 2 to print screen & ";
- 1140 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 1150 Z$=INKEY$:IF Z$="3"THEN GOSUB 1230:RETURN
- 1160 IF Z$="1"OR Z$="2"THEN GOSUB 1230:GOTO 1180
- 1170 GOTO 1150
- 1180 FOR QX=1 TO 24:FOR QY=1 TO 80
- 1190 LPRINT CHR$(SCREEN(QX,QY));
- 1200 NEXT QY:NEXT QX
- 1210 IF Z$="2"THEN LPRINT CHR$(12)
- 1220 GOTO 1120
- 1230 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-